/* GUI CONVERTED from relsrp.p (converter v1.76) Thu Feb 14 08:51:28 2002 */
/* relsrp.p  - REPETITIVE LINE SCHEDULE REPORT                                */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.5 $                                                           */
/*V8:ConvertMode=FullGUIReport                                                */
/* REVISION: 9.1      CREATED: 06/07/99   BY: *N005* Luke Pokic               */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane     */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb                  */
/* $Revision: 1.5 $    BY: Saurabh C.            DATE: 02/07/02  ECO: *N18M*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}


/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE relsrp_p_1 "Primary Run Sequence"
/* MaxLen: 23 Comment: Primary sort sequence */

&SCOPED-DEFINE relsrp_p_2 "Secondary Run Sequence"
/* MaxLen: 23 Comment: Secondary sort sequence */

&SCOPED-DEFINE relsrp_p_3 "Sort"
/* MaxLen: 5 Comment: Can be Ascending or Descending only */

&SCOPED-DEFINE relsrp_p_6 "Item Number"
/* MaxLen: 18 Comment: */

&SCOPED-DEFINE relsrp_p_7 "Rel Date"
/* MaxLen: 8 Comment: Release date */

&SCOPED-DEFINE relsrp_p_8 "Scheduled"
/* MaxLen: 12 Comment: Quantity scheduled */

&SCOPED-DEFINE relsrp_p_9 "Completed"
/* MaxLen: 12 Comment: Quantity completed */

&SCOPED-DEFINE relsrp_p_10 "Open"
/* MaxLen: 12 Comment: Quantity scheduled minus quantity completed*/

&SCOPED-DEFINE relsrp_p_11 "Due Date"
/* MaxLen: 8 Comment: */

&SCOPED-DEFINE relsrp_p_12 "Run Seq 1"
/* MaxLen: 9 Comment: Primary sort sequence*/

&SCOPED-DEFINE relsrp_p_13 "Run Seq 2"
/* MaxLen: 9 Comment: Secondary sort sequence*/

&SCOPED-DEFINE relsrp_p_14 "Ascending/Descending"
/* MaxLen: 20 Comment: Valid values for sort field*/

&SCOPED-DEFINE relsrp_p_15 "Release Date"
/* MaxLen: 23 Comment: Release date*/

/* ********** End Translatable Strings Definitions ********* */

define variable site            like wo_site      no-undo.
define variable site1           like wo_site      no-undo.
define variable prline          like rps_line     no-undo.
define variable prline1         like rps_line     no-undo.
define variable release_date    like wr_start     no-undo.
define variable release_date1   like ro_end       no-undo.
define variable primary_seq     like lnd_run_seq1 no-undo.
define variable primary_seq1    like lnd_run_seq1 no-undo.
define variable primary_sort    like mfc_logical  no-undo
   initial yes format {&relsrp_p_14}.
define variable secondary_seq   like lnd_run_seq2 no-undo.
define variable secondary_seq1  like lnd_run_seq2 no-undo.
define variable secondary_sort  like mfc_logical  no-undo
   initial yes format {&relsrp_p_14}.
define variable old_start       like release_date no-undo initial today.
define variable open_qty        like rps_qty_req  no-undo.
define variable l_site          as  character     format "x(8)"  no-undo.
define variable l_line          as  character     format "x(24)" no-undo.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
site              colon 24
   site1             colon 44 label {t001.i}
   prline            colon 24
   prline1           colon 44 label {t001.i}
   release_date      colon 24 label {&relsrp_p_15}
   release_date1     colon 44 label {t001.i}
   primary_seq       colon 24 label {&relsrp_p_1}
   primary_seq1      colon 44 label {t001.i}
   primary_sort      colon 66 label {&relsrp_p_3}
   secondary_seq     colon 24 label {&relsrp_p_2}
   secondary_seq1    colon 44 label {t001.i}
   secondary_sort    colon 66 label {&relsrp_p_3}
   skip(1)
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   rps_rel_date    column-label {&relsrp_p_7}  at 1
   rps_due_date    column-label {&relsrp_p_11} at 11
   lnd_run_seq1    column-label {&relsrp_p_12} at 21
   lnd_run_seq2    column-label {&relsrp_p_13} at 32
   rps_part        column-label {&relsrp_p_6}  at 43
   pt_desc1                                    at 63
   rps_qty_req     column-label {&relsrp_p_8}  at 89
   rps_qty_comp    column-label {&relsrp_p_9}  at 103
   open_qty        column-label {&relsrp_p_10} at 117
with STREAM-IO /*GUI*/  frame b down width 132.

/* SET EXTERNAL LABELS */
setFrameLabels(frame b:handle).

assign
   l_site = getTermLabelRtColon("SITE",8)
   l_line = getTermLabelRtColon("PRODUCTION_LINE",24).

/* INTERNAL PROCEDURES TO HANDLE CALLS TO relsrp.i */
PROCEDURE sort_run_seq_asc_asc:

   /* RUN SEQUENCE 1 ASCENDING, RUN SEQUENCE 2 ASCENDING */
    { relsrp.i " " " " }

END PROCEDURE.

PROCEDURE sort_run_seq_asc_desc:

   /* RUN SEQUENCE 1 ASCENDING, RUN SEQUENCE 2 DESCENDING */
    { relsrp.i " " descending }

END PROCEDURE.

PROCEDURE sort_run_seq_desc_asc:

   /* RUN SEQUENCE 1 DESCENDING, RUN SEQUENCE 2 ASCENDING */
    { relsrp.i descending " "}

END PROCEDURE.

PROCEDURE sort_run_seq_desc_desc:

   /* RUN SEQUENCE 1 DESCENDING, RUN SEQUENCE 2 DESCENDING */
    { relsrp.i descending descending }

END PROCEDURE.


{wbrp01.i}


/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   release_date = old_start.

   if site1 = hi_char
   then
      site1 = "".

   if prline1 = hi_char
   then
      prline1 = "".

   if (release_date = ? or release_date = low_date)
   then
      release_date = today.

   if release_date1 = hi_date
   then
      release_date1 = ?.

   if primary_seq1 = hi_char
   then
      primary_seq1 = "".

   if secondary_seq1 = hi_char
   then
      secondary_seq1 = "".

   if c-application-mode <> 'WEB'
   then
      
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   {wbrp06.i &command = update
             &fields = "site
                        site1
                        prline
                        prline1
                        release_date
                        release_date1
                        primary_seq
                        primary_seq1
                        primary_sort
                        secondary_seq
                        secondary_seq1
                        secondary_sort"
             &frm = "a"}

   if     (c-application-mode <> 'WEB')
      or  (c-application-mode = 'WEB'
      and (c-web-request begins 'DATA'))
   then do:

      /* CREATE BATCH INPUT STRING */
      bcdparm = "".

      {mfquoter.i site   }
      {mfquoter.i site1  }
      {mfquoter.i prline }
      {mfquoter.i prline1 }
      {mfquoter.i release_date }
      {mfquoter.i release_date1 }
      {mfquoter.i primary_seq }
      {mfquoter.i primary_seq1 }
      {mfquoter.i primary_sort }
      {mfquoter.i secondary_seq }
      {mfquoter.i secondary_seq1 }
      {mfquoter.i secondary_sort }

      if site1 = ""
      then
         site1 = hi_char.

      if prline1 = ""
      then
         prline1 = hi_char.

      if primary_seq1 = ""
      then
         primary_seq1 = hi_char.

      if secondary_seq1 = ""
      then
         secondary_seq1 = hi_char.

      if release_date  = ?
      then
         release_date = low_date.

      if release_date1 = ?
      then
         release_date1 = hi_date.

   end. /* c-application-mode <> 'WEB' .. */

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:




   /* INCLUDE FILE TO PRINT PAGE HEADING FOR REPORTS */
   {mfphead.i}

   old_start = release_date.

   /* LOGIC TO CALL relsrp.i WITH REQUIRED ORDER OF SORTING */
   if primary_sort
   then do:

      if secondary_sort
      then do:
         run sort_run_seq_asc_asc.
      end. /* IF secondary_sort  */

      else do:
         run sort_run_seq_asc_desc.
      end. /* ELSE DO secondary_sort  */

   end. /* IF primary_sort */
   else do:

      if secondary_sort
      then do:
         run sort_run_seq_desc_asc.
      end. /* IF secondary_sort */

      else do:
         run sort_run_seq_desc_desc.
      end. /* ELSE DO  secondary-sort  */

   end. /* ELSE DO primary_sort */

   /* REPORT TRAILER INCLUDE FILE  */
    
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end. /* REPEAT */

{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" site site1 prline prline1 release_date release_date1 primary_seq primary_seq1 primary_sort secondary_seq secondary_seq1 secondary_sort "} /*Drive the Report*/
